package top.wyloop.intoeins.response;

import lombok.Getter;

/**
 * @author Wyatt6
 * @date 2025/3/26
 */
@Getter
public class Response {
    private Boolean success;        // 处理成功/失败
    private String message;         // 响应信息
    private Map data = new Map();   // 响应数据
    private String traceId;         // 日志跟踪ID

    public Response() {
        this.success = false;   // 出于安全考量，构造函数中默认设置success标记为false（失败）
    }

    public Response success() {
        this.success = true;
        return this;
    }

    public Response fail() {
        this.success = false;
        return this;
    }

    public Response setMessage(String message) {
        this.message = message;
        return this;
    }

    public Response setData(Map data) {
        this.data = data;
        return this;
    }

    public Response addData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }

    public Response setTraceId(String traceId) {
        this.traceId = traceId;
        return this;
    }
}
